package com.qi.spzx.manager.mapper;

import com.qi.spzx.model.dto.system.AssginMenuDto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Description TODO
 * @Author dingchunlin
 * @Date 2024/2/22 16:47
 * @Version 1.0.0
 */
@Mapper
public interface SysRoleMenuMapper {


    @Select("select menu_id from  sys_role_menu where role_id = #{roleId} and is_deleted = 1 and is_half = 0")
    List<Long> findSysRoleMenuByRoleId(Long roleId);

    @Delete("delete from sys_role_menu where  role_id = #{roleId};")
    void deleteByRoleId(Long roleId);

    void doAssign(AssginMenuDto assginMenuDto);

    @Update("update sys_role_menu srm set srm.is_half = 1 where menu_id = #{menuId}")
    void updateSysRoleMenuIsHalf(Long id);
}
